package demo;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-04-03
 * Time: 7:51
 */
public class Test {
    public static void merge(int[] nums1, int m, int[] nums2, int n) {
        int x = m - 1;
        int y = n - 1;
        int z = n + m - 1;
        while (x >= 0 && y >= 0){
            if(nums1[x] > nums2[y]){
                nums1[z] = nums1[x];
                z--;
                x--;
            }else{
                nums1[z] = nums2[y];
                z--;
                y--;
            }
        }
        while(x >= 0){
            nums1[z] = nums1[x];
            z--;
            x--;
        }
        while (y >= 0){
            nums1[z] = nums2[y];
            z--;
            y--;
        }

    }
    public static int removeDuplicates(int[] nums) {
        int count = 0;
        for (int i = 0; i < nums.length; ++i) {
            if(nums[count] < nums[i]){
                nums[++count] = nums[i];
            }
        }
        return count + 1;
    }
    public static int removeElement(int[] nums, int val) {
        int count = 0;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] != val){
                nums[count] = nums[i];
                count++;
            }
        }

        return count;
    }
    public static void rotate(int[] nums, int k) {
        int lent = nums.length;
        int[] str = new int[lent];
        for (int i = 0; i < lent; i++) {
            str[(i + k) % lent] = nums[i];
        }
        for (int i = 0; i < lent; i++) {
            nums[i] = str[i];
        }
    }
/*    public static void rotate(int[] nums, int k) {
        int left = 0;
        int temp = 0;
        for (int i = 0; i < k; i++) {
            int right = nums.length - 1;
            temp = nums[right];
             while(right > left){
                 nums[right] = nums[right - 1];
                 right--;
             }
             nums[left] = temp;
        }
    }*/
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] arr = {1,1,3,6,5,6,7};
        int k = scanner.nextInt();
        int ret = merge(arr,k,);
        System.out.println(ret);
    }

}
